import type {
  AgeSexStatisticsRes,
  ClickCountsRes,
  HobbyTypePeopleCountingRes,
  JoinYearStatisticsRes,
  LevelOfEducationStatisticsRes,
  PoliticalOutlookStatisticsRes,
  ActivityStatisticsDataRes,
  ActivityStatisticsRes,
} from './model';

import { requestClient } from '#/api/request';

enum Api {
  getAgeSexStatistics = '/appB/ageSexStatistics',
  getClickStatistics = '/appB/clickStatistics',
  getEducationLevelStatistics = '/appB/educationLevelStatistics',
  getHobbyStatistics = '/appB/hobbyStatistics',
  getJoinYearStatistics = '/appB/joinYearStatistics',
  getOrgList = '/appA/getOrgList',
  getPoliticalOutlookStatistics = '/appB/politicalOutlookStatistics',
  getActivityStatistics = '/appB/activityStatistics',
  getActivityPlatformStatistics= '/appB/activityPlatformStatistics',
}
export function getAllOrgList() {
  return requestClient.get<object>(Api.getOrgList);
}
/**
 * 入会年份统计  传0按总数
 */
export function getJoinYearStatistics(orgId: number | string) {
  return requestClient.get<JoinYearStatisticsRes>(
    `${Api.getJoinYearStatistics}/${orgId}`,
  );
}

/**
 * 学历统计 传0按总数
 */
export function getEducationLevelStatistics(orgId: string) {
  return requestClient.get<LevelOfEducationStatisticsRes>(
    `${Api.getEducationLevelStatistics}/${orgId}`,
  );
}

/**
 * 兴趣爱好 传0按总数
 */
export function getHobbyStatistics(orgId: string) {
  return requestClient.get<HobbyTypePeopleCountingRes>(
    `${Api.getHobbyStatistics}/${orgId}`,
  );
}

/**
 * 点击量统计
 */
export function getClickStatistics(orgId: string) {
  return requestClient.get<ClickCountsRes>(
    `${Api.getClickStatistics}/${orgId}`,
  );
}

/**
 * 年龄间隔性别统计
 */
export function getAgeSexStatistics(orgId: string) {
  return requestClient.get<AgeSexStatisticsRes>(
    `${Api.getAgeSexStatistics}/${orgId}`,
  );
}

/**
 * 政治面貌统计
 */
export function getPoliticalOutlookStatistics(orgId: string) {
  return requestClient.get<PoliticalOutlookStatisticsRes>(
    `${Api.getPoliticalOutlookStatistics}/${orgId}`,
  );
}

/**
 * 组织开展活动
 * @param orgId 
 * @returns 
 */
export function getActivityStatistics(orgId: string) {
  return requestClient.get<ActivityStatisticsRes>(
    `${Api.getActivityStatistics}/${orgId}`,
  );
}

/**
 * 平台活动开展数据
 * @param orgId 
 * @returns 
 */
export function getActivityPlatformStatistics(orgId: string) {
  return requestClient.get<ActivityStatisticsDataRes>(
    `${Api.getActivityPlatformStatistics}/${orgId}`,
  );
}